package org.zhangsh.rabbitmq.queue.consumer;

import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import org.zhangsh.rabbitmq.queue.QueueDTO;

/**
 * </p>
 *
 * @author zhangsh
 * @version 1.0.0
 * @since 2019-03-13
 */
@Component
public class Consumer {

    @RabbitListener(queues = "hello-queue")
    public void consumer(String msg){

        System.out.println("consumer从hello-queue获取信息："+ msg);
    }

    @RabbitListener(queues = "hello-queue")
    public void consumer2(String msg){

        System.out.println("consumer2从hello-queue获取信息："+ msg);
    }

//    @RabbitListener(queues = "hello-queue2")
    public void consumer(QueueDTO dto){

        System.out.println("从hello-queue获取信息："+ dto.toString());
    }
}
